package com.loong.system.controller.common;

import com.loong.common.google.param.PlaceAutoCompleteParam;
import com.loong.common.google.param.PlaceDetailParam;
import com.loong.common.mvc.BaseController;
import com.loong.common.rest.Result;
import com.loong.system.handler.GoogleMapHandler;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("common/system/place")
public class PlaceController extends BaseController {

    @Resource
    private GoogleMapHandler googleMapHandler;

    /**
     * 搜索地址
     * @param param
     * @return
     */
    @PostMapping("search")
    public Result search(PlaceAutoCompleteParam param){
        return handlerExecutor.execute(()->googleMapHandler.search(param));
    }

    /**
     * 获取地址的详细信息
     * @param param
     * @return
     */
    @PostMapping("detail")
    public Result detail(PlaceDetailParam param){
        return handlerExecutor.execute(()->googleMapHandler.detail(param));
    }
}
